
// 监听标签页更新并自动跳转
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
  if (changeInfo.url && changeInfo.url.includes("sanhai.sh3.ikuai7.com")) {
    const url = new URL(changeInfo.url);
    const path = url.pathname + url.search + url.hash;
    const newUrl = "https://sanhaioj.longzhuge.com.cn" + path;
    chrome.tabs.update(tabId, { url: newUrl });
  }
});

// 扩展安装提示
chrome.runtime.onInstalled.addListener(() => {
  console.log("Sanhai OJ 跳转插件已安装");
});
